<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
		
		<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
		
		<title>{{title}}</title>
		
		<!--                       CSS                       -->
	  
		<!-- Reset Stylesheet -->
		<link rel="stylesheet" href="/static/resources/css/reset.css" type="text/css" media="screen" />
	  
		<!-- Main Stylesheet -->
		<link rel="stylesheet" href="/static/resources/css/style.css" type="text/css" media="screen" />
		
		<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
		<link rel="stylesheet" href="/static/resources/css/invalid.css" type="text/css" media="screen" />	
		
		<!-- Colour Schemes
	  
		Default colour scheme is green. Uncomment prefered stylesheet to use it.
		
		<link rel="stylesheet" href="/static/resources/css/blue.css" type="text/css" media="screen" />
		
		<link rel="stylesheet" href="/static/resources/css/red.css" type="text/css" media="screen" />  
	 
		-->
		
		<!-- Internet Explorer Fixes Stylesheet -->
		
		<!--[if lte IE 7]>
			<link rel="stylesheet" href="/static/resources/css/ie.css" type="text/css" media="screen" />
		<![endif]-->
		
		<!--                       Javascripts                       -->
  
		<!-- jQuery -->
		<script type="text/javascript" src="/static/resources/scripts/jquery-1.3.2.min.js"></script>
		
		<!-- jQuery Configuration -->
		<script type="text/javascript" src="/static/resources/scripts/simpla.jquery.configuration.js"></script>
		
		<!-- Facebox jQuery Plugin -->
		<script type="text/javascript" src="/static/resources/scripts/facebox.js"></script>
		
		<!-- jQuery WYSIWYG Plugin -->
		<script type="text/javascript" src="/static/resources/scripts/jquery.wysiwyg.js"></script>
		
		<!-- jQuery Datepicker Plugin -->
		<script type="text/javascript" src="/static/resources/scripts/jquery.datePicker.js"></script>
		<script type="text/javascript" src="/static/resources/scripts/jquery.date.js"></script>
		<!--[if IE]><script type="text/javascript" src="/static/resources/scripts/jquery.bgiframe.js"></script><![endif]-->

		
		<!-- Internet Explorer .png-fix -->
		
		<!--[if IE 6]>
			<script type="text/javascript" src="/static/resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
			<script type="text/javascript">
				DD_belatedPNG.fix('.png_bg, img, li');
			</script>
		<![endif]-->
		
		<script  src="/static/ckeditor.js"></script>
	</head>
  
	<body><div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
		
		<div id="sidebar"><div id="sidebar-wrapper"> <!-- Sidebar with logo and menu -->
			
				<h1 id="sidebar-title"><a href="/">{{title}}</a></h1>
		  
			<!-- Logo (221px wide) -->
			<a href="#"><img id="logo" src="/static/resources/images/logo.png" alt="Simpla Admin logo" /></a>
		  
			<!-- Sidebar Profile links -->
			<div id="profile-links">
				Hello, <a href="#" title="Edit your profile">{{user}}</a>
				<br />
				<a href="/" title="查看站点">查看站点</a> | <a href="/logout" title="Sign Out">登出</a>
			</div>        
			
			<ul id="main-nav">  <!-- Accordion Menu -->
				
				<li>
					<a href="/admin" class="nav-top-item no-submenu"> <!-- Add the class "no-submenu" to menu items with no sub menu -->
						仪表盘
					</a>       
				</li>
				
				<li> 
					<a href="#" class="nav-top-item current"> <!-- Add the class "current" to current menu item -->
					文章
					</a>
					<ul>
						<li><a class="current" href="/admin/write">写文章</a></li>
						<li><a href="/admin/articles">所有文章</a></li> <!-- Add class "current" to sub menu items also -->
						<li><a href="/admin/comments">管理评论</a></li>
						<li><a href="/admin/categories">管理分类</a></li>
					</ul>
				</li>
				
				<li>
					<a href="#" class="nav-top-item">
						页面
					</a>
					<ul>
						<li><a href="/admin/pages/new">新建页面</a></li>
						<li><a href="/admin/pages">管理页面</a></li>
					</ul>
				</li>
				
				<li>
					<a href="#" class="nav-top-item">
						设置
					</a>
					<ul>
						<li><a href="/admin/setting">常规</a></li>
					</ul>
				</li>      
				
			</ul> <!-- End #main-nav -->
			
		</div></div> <!-- End #sidebar -->
		
		<div id="main-content"> <!-- Main Content Section with everything -->
		%if 'info' in dir():
		%if info == 'Error':
			<div class="notification error png_bg">
				<a href="#" class="close"><img src="/static/resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
				<div>
					表单各项都不允许为空,检查是否有忘记填写的!
				</div>
			</div>
		%elif info == 'Success':
			<div class="notification success png_bg">
				<a href="#" class="close"><img src="/static/resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
				<div>
					{{info}}
				</div>
			</div>
		%end
		%end
				<div class="tab-content">
					%if 'edit' in dir():
						%if edit:
						<form action="/admin/write/edit/posts" method="post">
						%else:
						<form action="/admin/write/posts" method="post">
						%end
					%end
							
							<fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								<p>
									<label>文章标题</label>
									<input class="text-input medium-input datepicker" type="text" id="title" name="title" value="{{post_title}}" />
								</p>								
								<p>
								<label>文章内容</label>
								<textarea id="content" name="content" cols="10" rows="10">{{post_content}}</textarea>
								<script type="text/javascript">
									CKEDITOR.replace('content');
								</script>
								<br />					
								</p>

								<p>
									<label>文章分类</label>
									%if categories:
										%for cate in categories:
											%cid = cate.get('_id')
											%catename = cate.get('name')
									        %if cids:
											%if cid in cids:
									            <input type="checkbox" name="cate-{{cid}}" value="{{cid}}" checked /> {{catename}}
											%else:
												<input type="checkbox" name="cate-{{cid}}" value="{{cid}}" /> {{catename}}
											%end
											% else:
												<input type="checkbox" name="cate-{{cid}}" value="{{cid}}" /> {{catename}}
												%end
									%end
									%else:
												
									<div class="notification attention png_bg">
										<a href="#" class="close"><img src="/static/resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
										<div>
										没有分类目录请先<a href="/admin/categories#tab2">新建分类目录</a>
										</div>
									</div>
									%end
								</p>
								
								<p>
									<label>标签</label>
										<input class="text-input small-input" type="text" id="tags" name="tags" value="{{tags}}" /> 
										<br /><small>标签用,号分开</small>
								</p>

								<p>
								%if 'edit' in dir():
									%if edit:
									<input type="hidden" name="artid" value="{{artid}}" />
									<input class="button" type="submit" value="更新" />
									%else:
									<input class="button" type="submit" value="Submit" />
									%end
								%end
								</p>
								
							</fieldset>
							
							<div class="clear"></div><!-- End .clear -->
							
						</form>
						
					</div> <!-- End #tab2 -->        
			
			<div class="clear"></div>
			
			<div id="footer">
				<small> <!-- Remove this notice or replace it with whatever you want -->
						&#169; Copyright 2012 cold night | Powered by <a href="http://www.linuxzen.com">cold night</a> | <a href="#">Top</a>
				</small>
			</div><!-- End #footer -->
			
		</div> <!-- End #main-content -->
		
	</div></body>
  
</html>
